Skip to content

Conversation

@Heisenberg208
Copy link
Collaborator

Pull Request Template

Description

This PR provides a boiler plate template which does not include streamlit

@recursivezero
Copy link
Owner

where did we check db connection?
also add clean command in cli

@Heisenberg208
Copy link
Collaborator Author

from starlette.exceptions import HTTPException as StarletteHTTPException
.
.
.
.
@app.exception_handler(StarletteHTTPException)
async def http_exception_handler(request: Request, exc: StarletteHTTPException):
    if exc.status_code == 404:
        endpoint = request.url.path

        return JSONResponse(
            status_code=404,
            content={
                "error": f"Endpoint '{endpoint}' does not exist, use /docs to see available endpoints.",
                "status": 404,
            },
        )

    # fallback for other HTTP errors
    return JSONResponse(
        status_code=exc.status_code,
        content={"error": exc.detail},
    )

custom message for invalid url endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants